//
//  CNBBSSectionCell.m
//  CsdnPlus
//
//  Created by 孟瑞瑞 on 2018/6/8.
//  Copyright © 2018年 CSDN. All rights reserved.
//

#import "CNBBSSectionCell.h"
#import <CNBaseTool/CNCategoryHeader.h>
#import <Masonry/Masonry.h>
@interface CNBBSSectionCell ()

@property (nonatomic, strong) UIView *hLineView;

@end

@implementation CNBBSSectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(UILabel *)titleLb
{
    if (!_titleLb) {
        _titleLb = [[UILabel alloc]init];
        _titleLb.theme_textColor = cellTitleTextColorPicker;
        _titleLb.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_titleLb];
        [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(12);
            make.right.mas_equalTo(-12);
            make.centerY.mas_equalTo(0);
        }];
    }
    return _titleLb;
}

-(UIView *)lineView
{
    if (!_lineView) {
        _lineView = [[UIView alloc]init];
        _lineView.theme_backgroundColor = bbsSectionLineColorPicker;
        [self.contentView addSubview:_lineView];
        [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(0);
            make.height.mas_equalTo(0.5);
            make.bottom.mas_equalTo(-0.3);
        }];
        _lineView.layer.zPosition = 20;
    }
    return _lineView;
}

-(UIView *)hLineView
{
    if (!_hLineView) {
        _hLineView = [[UIView alloc]init];
        _hLineView.theme_backgroundColor = bbsSectionLineColorPicker;
        [self.contentView addSubview:_hLineView];
        [_hLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.right.bottom.mas_equalTo(0);
            make.width.mas_equalTo(0.5);
        }];
        _hLineView.layer.zPosition = 20;
    }
    return _hLineView;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    if (selected)
    {
        self.contentView.theme_backgroundColor = pageBGColorPicker;
        self.hLineView.hidden = YES;
    }
    else
    {
        self.contentView.theme_backgroundColor = searchPageBGColorPicker;
        self.hLineView.hidden = NO;
    }
}

-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    [super setHighlighted:highlighted animated:animated];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.theme_backgroundColor = pageBGColorPicker;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    return self;
}

@end
